declare global {
	interface Date {
		format(f: string): String;
	}
}
Date.prototype.format = function (fmt) {
	var o = {
		"M+": this.getMonth() + 1, //月份 
		"d+": this.getDate(), //日 
		"h+": this.getHours(), //小时 
		"m+": this.getMinutes(), //分 
		"s+": this.getSeconds(), //秒 
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		"f+": ('' + this.getMilliseconds()).padStart(3, '0') //毫秒 
	};
	if (/(y+)/.test(fmt)) {
		let item =/(y+)/.exec(fmt)![1];
		fmt = fmt.replace(item, (this.getFullYear() + "").substring(4 - item.length));
	}
	for (var k in o) {
		var reg =new RegExp("(" + k + ")");
		if (reg.test(fmt)) {
			let item = reg.exec(fmt)![1];
			let pre ="".padStart(item.length,'0');
			let v = o[k];
			fmt = fmt.replace(item, (item.length == 1) ? v : ((pre + v).substring(("" + v).length)));
		}
	}
	return fmt;
}
export { }; 